using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Belmost4PDA.Constants;
using Belmost4PDA.Fasade;

namespace Belmost4PDA.Logic
{
    public class Control_Main: AbstractControl
    {
        public bool EmptyGrid = false;
        public bool Editablef = false;
        /// <summary>
        /// Gets the grid.
        /// </summary>
        /// <returns></returns>
        public override AbstractControl GetGrid()
        {
            foreach (AbstractControl control in ChildControls)
            {
                if(control.GetControlType()==ControlType.GridGroup)
                {
                    return (Control_Grid) control;
                }
            }
            return null;
        }

        /// <summary>
        /// Gets the type of the control.
        /// </summary>
        /// <returns></returns>
        public override string GetControlType()
        {
            return ControlType.MainControl;
        }
        public override bool Editable()
        {
            return Editablef;
        }
        /// <summary>
        /// Gets the controls of panel.
        /// </summary>
        /// <param name="controlsList">The controls list.</param>
        /// <param name="IdPanel">The id panel.</param>
        public override void GetControlsOfPanel(List<AbstractControl> controlsList, int IdPanel)
        {
            foreach (AbstractControl childControl in ChildControls)
            {
                childControl.GetControlsOfPanel(controlsList, IdPanel);
                
            }
        }
      
        /// <summary>
        /// Gets the mapper.
        /// </summary>
        /// <returns></returns>
        public override AbstractMapper GetMapper()
        {
            return null;
        }

        public override Control GetFormControl()
        {
           return null;
        }

        public override string GetCaption()
        {
            return null;
        }

        private string gridIdVal = "";

        public Control_Main(object edit)
        {
            if(edit!=null)
            Editablef = edit.ToString()=="1";
        }

        public string GridIDValue
        {
            get { return gridIdVal; }
            set { gridIdVal = value; }
        }
    }
}
